<template>
	<view class="treeroot">
		<view class="">
			<uv-tabs :list="list" :is-scroll="false" lineColor="#B10D0C" :current="current" activeStyle="orange"
				lineWidth="45" lineHeight="5" :itemStyle="{ width: '375rpx', height: '100rpx', padding: '0rpx' }"
				@change="changeTab">
			</uv-tabs>
			<OrderCard :orderData="orderList" />
		</view>
	</view>
</template>
<script setup>
import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app";
import { ref } from 'vue';
import { getOrder } from '@/api/order.js'
import OrderCard from '@/components/order-card/order-card.vue'
const list = [
	{
		name: "全部订单",
	},
	{
		name: "未完成",
	},
]
const current = ref(0)
const orderList = ref([])
const changeTab = (e) => {
	current.value = e.index;
	getOrderList()
}
const getOrderList = () => {
	getOrder({
		queryStatus: current.value
	}).then(res => {
		orderList.value = res.data
		uni.stopPullDownRefresh()
	})
}
onLoad(() => {
	getOrderList()
})

onPullDownRefresh(() => {
	getOrderList()
})
</script>


<style lang="scss" scoped>
::v-deep .uni-card {
	border-radius: 20rpx !important;
}
</style>
